package org.jeecg.modules.xxgx.fpgl.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.innerApi.common.requestDto.CurrentFphmParam;
import org.jeecg.modules.innerApi.common.requestDto.InvoiceParam;
import org.jeecg.modules.innerApi.common.responseDto.CurrentFphmRtn;
import org.jeecg.modules.innerApi.common.responseDto.InvoiceRtn;
import org.jeecg.modules.xxgx.common.service.IXxBase;
import org.jeecg.modules.xxgx.fpgl.service.IFpkjglService;
import org.jeecg.modules.xxgx.fpgl.param.BacthInvoiceParam;
import org.jeecg.modules.xxgx.fpgl.vo.FphcPLPage;
import org.jeecg.modules.xxgx.fpgl.vo.FphcPLRtn;
import org.jeecg.modules.xxgx.fpgl.vo.YkfpzfRtn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* @Description: 销项发票开具管理
* @Author: jeecg-boot
* @Date:   2023-08-16
* @Version: V1.0
*/
@Api(tags="销项发票开具管理")
@RestController
@RequestMapping("/xxgx/fpkjgl")
@Slf4j
public class FpkjglController {

   @Autowired
   private IFpkjglService xxFpkjglService;
   @Autowired
   private IXxBase base;

   /**
    *   当前未使用发票号
    *
    * @param params
    * @return
    */
   @AutoLog(value = "销项发票开具管理-当前未使用发票号")
   @ApiOperation(value="销项发票开具管理-当前未使用发票号", notes="销项发票开具管理-当前未使用发票号")
   @PostMapping(value = "/getCurrentFphm")
   public Result<CurrentFphmRtn.CurrentFphmRtnData> getCurrentFphm(@RequestBody CurrentFphmParam params) {
      return  base.currentFphm(params);
   }

   /**
    *   根据待开单据批量开票
    *
    * @param params
    * @return
    */
   @AutoLog(value = "销项发票开具管理-批量发票开具")
   @ApiOperation(value="销项发票开具管理-根据待开单据批量开票", notes="销项发票开具管理-根据待开单据批量开票")
   @PostMapping(value = "/batchInvoice")
   public Result<String> batchInvoice(@RequestBody BacthInvoiceParam params) {
      return xxFpkjglService.batchInvoice(params);
   }

   /**
    *  发票单张开具
    *
    * @param params
    * @return
    */
   @AutoLog(value = "销项发票开具管理-单张发票开具")
   @ApiOperation(value="销项发票开具管理-单张发票开具", notes="销项发票开具管理-单张发票开具")
   @PostMapping(value = "/invoice")
   public Result<InvoiceRtn.InvoiceRtnData> invoice(@RequestBody InvoiceParam params) {
      return xxFpkjglService.invoice(params);
   }

   /**
    *  已开发票作废
    *
    * @param ids
    * @return
    */
   @AutoLog(value = "销项发票开具管理-已开发票作废")
   @ApiOperation(value="销项发票开具管理-已开发票作废", notes="销项发票开具管理-已开发票作废")
   @PostMapping(value = "/ykfpzf")
   public Result<List<YkfpzfRtn>> ykfpzf(@ApiParam(value = "发票信息ID数组", required = true)@RequestBody List<String> ids) {
      return xxFpkjglService.ykfpzf(ids);
   }

   /**
    * 批量红冲
    * @param fphcPage
    * @return
    */
   @AutoLog(value = "销项发票开具管理-批量红冲")
   @ApiOperation(value="销项发票开具管理-批量红冲", notes="销项发票开具管理-批量红冲")
   @PostMapping(value = "/fphc")
   public Result<List<FphcPLRtn>> fphc(@ApiParam(value = "发票红冲", required = true)@RequestBody @Valid FphcPLPage fphcPage) {
      return xxFpkjglService.plhc(fphcPage);
   }
}
